﻿Imports Logistica.Data
Imports Logistica.Entities

Public NotInheritable Class TipoMovimiento

    Public Shared Function Listar() As List(Of TipoMovimientoBE)
        Dim listado As New List(Of TipoMovimientoBE)
        Dim componenteDatos As New TipoMovimientoDO


        Try
            listado = componenteDatos.Listar

        Catch ex As Exception
            Throw ex
        Finally
            componenteDatos = Nothing

        End Try

        Return listado
    End Function

    Public Shared Function Registrar(infoTipoProducto As TipoMovimientoBE) As Integer
        Dim idRegistro As Integer = 0
        Dim componenteDatos As New TipoMovimientoDO

        Try
            If componenteDatos.Obtener(infoTipoProducto).IsEmpty Then
                idRegistro = componenteDatos.Insertar(infoTipoProducto)
            Else

                idRegistro = infoTipoProducto.Id
                componenteDatos.Actualizar(infoTipoProducto)
            End If

        Catch ex As Exception
            Throw ex

        Finally
            componenteDatos = Nothing
        End Try

        Return idRegistro
    End Function

    Public Shared Sub Eliminar(infoTipoMovimiento)
        Dim componenteDatos As New TipoMovimientoDO

        Try
            componenteDatos.Eliminar(infoTipoMovimiento)

        Catch ex As Exception
            Throw ex

        Finally
            componenteDatos = Nothing
        End Try

    End Sub

    Shared Function Obtener(infoTipoMovimiento As TipoMovimientoBE) As TipoMovimientoBE
        Dim componenteDatos As New TipoMovimientoDO
        Dim tipoMovimientoRegistrado As New TipoMovimientoBE

        Try
            tipoMovimientoRegistrado = componenteDatos.Obtener(infoTipoMovimiento)

        Catch ex As Exception
            Throw ex
        Finally
            componenteDatos = Nothing

        End Try

        Return tipoMovimientoRegistrado
    End Function

End Class
